#include<stdio.h>

int leap(int year)
{
	if (year % 4 == 0 && year % 100 == 0 || year % 400 == 0)
	{
		return 1;
	}
	else
	{
		return 0;
	}
}

int number(int year, int month, int day)
{
	int sum = 0, i, j, k;
	int a[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
	int b[12] = { 31,29,31,30,31,30,31,31,30,31,30,31 };
	if (leap(year))
	{
		for (i = 0; i < month - 1; i++)
		{
			sum = sum + b[i];
		}
		sum = sum + day;
	}
	else
	{
		for (j = 0; j < month - 1; j++)
		{
			sum = sum + a[j];
		}
		sum = sum + day;
	}

	for (j = 2011;j < year;j++)
	{
		if (leap(j))
		{
			sum = sum + 366;
		}
		else
		{
			sum = sum + 365;
		}
	}
	sum += day;
	return sum;
}

int main()
{
	int year, month, day;
	printf("Please input a date (year month day):");
	scanf_s("%d %d %d", &year, &month, &day);
	int n = number(year, month, day);
	if ((n % 5) < 4 && (n & 5) > 0)
	{
		printf("Work\n");
	}
	else
	{
		printf("Rest\n");
	}
	return 0;
}